package com.qf.listener;

import com.alibaba.fastjson.JSON;
import com.qf.pojo.UserMsg;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

@Component
@RocketMQMessageListener(topic = "test",consumerGroup = "rocket-con-group1")
public class RocketMQConsumer3 implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {

        UserMsg userMsg = JSON.parseObject(message, UserMsg.class);

        Integer keys = userMsg.getId();
        String tags = userMsg.getTag();
        String s = userMsg.getMsg();


        System.out.println("con3===key:" + keys +"--tags:" + tags + "--msg:" + s);

    }
}
